home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 276 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.0 KB  |  52 lines

  1. Newsgroups: comp.lang.c
  2. Path: gail.ripco.com!mambuhl
  3. From: mambuhl@ripco.com (Martin Ambuhl)
  4. Subject: Re: prototypes           
  5. X-Nntp-Posting-Host: foley.ripco.com
  6. Message-ID: <DKMnIG.JMI@rci.ripco.com>
  7. Sender: usenet@rci.ripco.com (Net News Admin)
  8. Organization: Ripco Internet BBS Chicago
  9. Date: Wed, 3 Jan 1996 22:51:52 GMT
  10. X-Ident-Sender: mambuhl
  11.  
  12. jason_gredley@mindlink.bc.ca (Jason Gredley)
  13. in <jason_gredley.5.30EA3371@mindlink.bc.ca> writes:
  14.  
  15. >        Formerly I have been programing in C++.  Recently however I thought I
  16. >should at least do a few programs in C, if for nothing else, ability to say
  17. >that I can program in C.  Normally in C++ I would include appropriate header
  18. >files and then at any point be free to call those functions included in that
  19. >header file.  However when compiling a C program the compiler is generating a
  20. >zillion _warnings_ of "call to function with no prototype"...
  21.  
  22. If you are indeed #including the headers, and those headers contain the
  23. needed prototypes, then your compiler is broken.  Show us an example of
  24. this.
  25.  
  26. >....  Looking at C
  27. >example programs, etc it seems customary to identify prototypes at the top of
  28. >a module as well as including header files (this seems redundant)...
  29.  
  30. You are looking at bad example programs.  It is redundant, since the
  31. effect of #including the header files is precisely to put the
  32. information from the header into the source.
  33.  
  34. >...  I am even
  35. >getting the same warning about calling strcpy (a library function) after
  36. >including the "string.h" header;...
  37.  
  38. Again,
  39.     1) you are not #including <string.h> - or -
  40.     2) string.h does not contain the needed prototypes - or -
  41.     3) your compiler is broken.
  42.  
  43. Since you say that you are including "string.h", if you have a file with
  44. this name in the search path for user supplied headers, your program
  45. will never see the system header string.h.  There is a difference
  46. between "string.h" and <string.h>.  This is true for C++ also.
  47.  
  48.                                                               
  49. --
  50. * Martin Ambuhl       net: mambuhl@ripco.com
  51. * Chicago, IL (USA)    
  52.